import { BaseModel } from '@/common/base/base.model';
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm';
import { ArticleModel } from "@/module/article/article.model";

@Entity('ARTICLE_EXT', {
  synchronize: false,
}) // 普通文章扩展
export class ArticleExtModel extends BaseModel {
  @Column({
    comment: '文章uuid',
    type: 'uuid',
  })
  articleUuid: string;
  @OneToOne(() => ArticleModel, {
    createForeignKeyConstraints: false
  })
  @JoinColumn({
    name: 'article_uuid',
    referencedColumnName: 'uuid',
  })
  article?: ArticleExtModel;

  @Column({
    comment: '内容（HTML格式）',
    type: 'varchar',
    length: 999999,
    default: '',
  })
  content: string;

  @Column({
    comment: '内容（Raw格式）',
    type: 'varchar',
    length: 999999,
    default: '',
  })
  contentRaw: string;
}
